package com.kede.api.order.controller;

import com.kede.api.order.controller.po.RefusePackageOrderPo;
import com.kede.api.order.controller.po.SurePackageOrderPo;
import com.kede.api.order.service.IPackageManageService;
import com.kede.pojo.PackageOrderStatus;
import com.kede.pojo.PagePO;
import com.kede.pojo.ResHttp;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author:Pr.li
 * @Date: create in 2023/9/23 9:39
 */
@RestController
@RequestMapping("order/packageOrder")
public class PackageOrderController {

    @Resource
    private IPackageManageService packageManageService;

    @GetMapping("getPackageOrderList")
    public ResHttp getPackageOrderList(PagePO pagePO, Integer cerId, Integer isSrc, PackageOrderStatus status){
        return packageManageService.getPackageOrderList(pagePO,cerId,isSrc,status);
    }

    @GetMapping("getPackageOrderDetail")
    public ResHttp getPackageOrderDetail(Integer id){
        return packageManageService.getPackageOrderDetail(id);
    }

    @PostMapping("surePackageOrder")
    public ResHttp surePackageOrder(@RequestBody @Validated SurePackageOrderPo surePackageOrderPo){
        return packageManageService.surePackageOrder(surePackageOrderPo);
    }

    @PostMapping("refusePackageOrder")
    public ResHttp refusePackageOrder(@RequestBody @Validated RefusePackageOrderPo refusePackageOrderPo){
        return packageManageService.refusePackageOrder(refusePackageOrderPo);
    }

    @GetMapping("delOrder")
    public ResHttp delOrder(Integer id){
        return packageManageService.delOrder(id);
    }

}
